import { createUserService, deleteUserService, getUserListService, getUserDetailService, updateUserService } from "@/services/admin/user";
import express from "express";

const router = express.Router();

router.get("/", (req, res) => {
    /*
		#swagger.tags = ['管理端用户']
		#swagger.path = '/admin-api/user'
		#swagger.description = '获取用户分页数据'
		#swagger.security = [{"bearerAuth": []}]
		#swagger.parameters['page'] = { in: 'query', description: '页号', type: 'integer' }
		#swagger.parameters['pageSize'] = { in: 'query', description: '每页个数', type: 'integer' }
		#swagger.parameters['username'] = { in: 'query', description: '用户名', type: 'string' }
		#swagger.parameters['email'] = { in: 'query', description: '邮箱', type: 'string' }
		#swagger.parameters['nickname'] = { in: 'query', description: '昵称', type: 'string' }
	*/
    getUserListService(req, res);
});
router.get("/:_id", (req, res) => {
    /*
		#swagger.tags = ['管理端用户']
		#swagger.path = '/admin-api/user/{_id}'
		#swagger.description = '获取指定用户'
		#swagger.security = [{"bearerAuth": []}]
		#swagger.parameters['_id'] = { in: 'path', description: '用户ID', type: 'string', required: true }
	*/
    getUserDetailService(req, res);
});
router.post("/", (req, res) => {
    /*
		#swagger.tags = ['管理端用户']
		#swagger.path = '/admin-api/user'
		#swagger.description = '创建用户'
		#swagger.security = [{"bearerAuth": []}]
		#swagger.requestBody = {
			required: true,
			content: {
				"application/json": {
					schema: {
						type: "object",
						required: ['username','email','password'],
						properties: {
							username: { description: '用户名', type: 'string' },
							email: { description: '邮箱', type: 'string' },
							roles: { description: '角色', type: 'array', items: { type: 'string' } },
							status: { description: '状态', type: 'boolean' },
							password: { description: '密码', type: 'string' },
							nickname: { description: '昵称', type: 'string' },
							avatar: { description: '头像', type: 'string' },
							remark: { description: '备注', type: 'string' }
						}
					}
				}
			}
		}
	*/
    createUserService(req, res);
});
router.put("/", (req, res) => {
    /*
		#swagger.tags = ['管理端用户']
		#swagger.path = '/admin-api/user'
		#swagger.description = '更新用户'
		#swagger.security = [{"bearerAuth": []}]
		#swagger.requestBody = {
			required: true,
			content: {
				"application/json": {
					schema: {
						type: "object",
						required: ['_id'],
						properties: {
							_id: { description: '用户ID', type: 'string' },
							username: { description: '用户名', type: 'string' },
							email: { description: '邮箱', type: 'string' },
							roles: { description: '角色', type: 'array', items: { type: 'string' } },
							status: { description: '状态', type: 'boolean' },
							password: { description: '密码', type: 'string' },
							nickname: { description: '昵称', type: 'string' },
							avatar: { description: '头像', type: 'string' },
							remark: { description: '备注', type: 'string' }
						}
					}
				}
			}
		}
	*/
    updateUserService(req, res);
});
router.delete("/", (req, res) => {
    /*
		#swagger.tags = ['管理端用户']
		#swagger.path = '/admin-api/user'
		#swagger.description = '删除用户'
		#swagger.security = [{"bearerAuth": []}]
		#swagger.requestBody = {
			required: true,
			content: {
				"application/json": {
					schema: {
						type: "object",
						required: ['_id'],
						properties: {
							_id: { description: '用户ID', type: 'string' },
						}
					}
				}
			}
		}
	*/
    deleteUserService(req, res);
});

export default router;
